package com.lotter.api.controller;

import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;


/**
 * 绑卡业务
 * @author zhangzechi
 *
 */
@Controller
@RequestMapping(value="/test/code")
public class TestCodeCardController extends BaseController {
	
	/**
	 * 绑卡
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/findBank",method=RequestMethod.GET)
	public void findBank(HttpServletRequest request,HttpServletResponse response,
			@RequestParam(value="callback",required= true)String callback)throws Exception {
	
		response.setContentType("text/javascript");
    	Map<String,Object> result = new HashMap<String, Object>();
    	result.put("status", 200);

    	PrintWriter out = response.getWriter(); 
		out.write(callback + "(");
		out.print(JSON.toJSONString(result));
		out.write(");");
	}
	
	
	@RequestMapping(value="/index",method=RequestMethod.GET)
	public String test(HttpServletRequest request) throws Exception{
		System.out.println("nihao  再试一次");
		System.out.println("要打印出来啊我会疯的");
		logger.error("要打印出来一次啊");

		return "index" ;
	}

	
}
